package com.lz.ht.controller;

import com.lz.ht.model.Room;
import com.lz.ht.model.Roomlog;
import com.lz.ht.page.PageModel;
import com.lz.ht.service.RoomLogService;
import com.lz.ht.service.RoomService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName: RoomLogController
 * @Description:
 * @Author: CHonghao
 * @Date: 2021/7/9 16:27
 * @Version: V1.0
 **/

@Slf4j
@Controller
public class RoomLogController {

    @Autowired
    private RoomLogService roomLogServiceImpl;

    @RequestMapping(value = "/roomlog/list", method = {RequestMethod.GET})
    public String roomlog_list() throws Exception {
        return "roomlog/roomlog_list";
    }


    @RequestMapping(value = "/roomlog/list", method = {RequestMethod.POST})
    @ResponseBody
    public PageModel list(Roomlog roomlog, PageModel<Roomlog> page) throws Exception {
        page.init();
        List<Roomlog> list = roomLogServiceImpl.findPageList(page, roomlog);
        long count = roomLogServiceImpl.findCount(roomlog);
        page.packData(count, list);
        return page;
    }
}
